home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / languages / obrn-a_1.5_lib.lha / oberon-a / source1.lha / source / amiga / Expansion.mod < prev    next >
Encoding:
Text File  |  1995-01-26  |  6.5 KB  |  226 lines

  1. (***************************************************************************
  2.  
  3.      $RCSfile: Expansion.mod $
  4.   Description: Interface to expansion.library
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.7 $
  8.       $Author: fjc $
  9.         $Date: 1995/01/26 02:39:55 $
  10.  
  11.   Includes Release 40.15
  12.  
  13.   (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  14.       All Rights Reserved
  15.  
  16.   Oberon-A interface Copyright © 1994-1995, Frank Copeland.
  17.   This file is part of the Oberon-A Interface.
  18.   See Oberon-A.doc for conditions of use and distribution.
  19.  
  20. ***************************************************************************)
  21.  
  22. <* STANDARD- *> <* INITIALISE- *> <* MAIN- *>
  23. <*$ CaseChk-  IndexChk- LongVars+ NilChk-  *>
  24. <*$ RangeChk- StackChk- TypeChk-  OvflChk- *>
  25.  
  26. MODULE [2] Expansion;
  27.  
  28. IMPORT SYS := SYSTEM, Kernel, e := Exec, d := Dos, c := Config, s := Sets;
  29.  
  30.  
  31. (*
  32. **      $VER: expansion.h 36.7 (28.5.90)
  33. **
  34. **      External definitions for expansion.library
  35. *)
  36.  
  37. CONST
  38.  
  39.   expansionName * = "expansion.library";
  40.  
  41. (* flags for the AddDosNode() call *)
  42.  
  43.   startProc *  = 0;
  44.  
  45. (*
  46. **      $VER: expansionbase.h 36.15 (21.10.91)
  47. **
  48. **      Definitions for the expansion library base
  49. *)
  50.  
  51.  
  52. (* BootNodes are scanned by dos.library at startup.  Items found on the
  53.    list are started by dos. BootNodes are added with the AddDosNode() or
  54.    the V36 AddBootNode() calls. *)
  55.  
  56. TYPE
  57.  
  58.   BootNodePtr * = POINTER TO BootNode;
  59.   BootNode * = RECORD (e.NodeBase)
  60.     base *       : e.Node;
  61.     flags *      : s.SET16;
  62.     deviceNode * : e.NodePtr;
  63.   END; (* BootNode *)
  64.  
  65.  
  66. (* expansion.library has functions to manipulate most of the information in
  67.    ExpansionBase.  Direct access is not permitted.  Use FindConfigDev()
  68.    to scan the board list. *)
  69.  
  70. TYPE
  71.  
  72.   ExpansionBasePtr * = POINTER TO ExpansionBase;
  73.   ExpansionBase * = RECORD (e.LibraryBase)
  74.     libNode *   : e.Library;
  75.     flags -     : s.SET8;         (* read only (see below) *)
  76.     private01   : e.UBYTE;        (* private *)
  77.     private02   : e.ULONG;        (* private *)
  78.     private03   : e.ULONG;        (* private *)
  79.     private04   : c.CurrentBinding; (* private *)
  80.     private05   : e.List;         (* private *)
  81.     mountList * : e.List;         (* contains struct BootNode entries *)
  82.     (* private *)
  83.   END; (* ExpansionBase *)
  84.  
  85. CONST
  86.  
  87. (* error codes *)
  88.   ok *           = 0;
  89.   lastBoard *    = 40;  (* could not shut him up *)
  90.   noExpansion *  = 41;  (* not enough expansion mem; board shut up *)
  91.   noMemory *     = 42;  (* not enough normal memory *)
  92.   noBoard *      = 43;  (* no board at that address *)
  93.   badMem *       = 44;  (* tried to add bad memory card *)
  94.  
  95. (* Flags *)
  96.  
  97.   ebClogged *     = 0;       (* someone could not be shutup *)
  98.   ebShortMem *    = 1;       (* ran out of expansion mem *)
  99.   ebBadMem *      = 2;       (* tried to add bad memory card *)
  100.   ebDosFlag *     = 3;       (* reserved for use by AmigaDOS *)
  101.   ebKickBack33 *  = 4;       (* reserved for use by AmigaDOS *)
  102.   ebKickBack36 *  = 5;       (* reserved for use by AmigaDOS *)
  103.  
  104. (* If the following flag is set by a floppy's bootblock code, the initial
  105.    open of the initial shell window will be delayed until the first output
  106.    to that shell.  Otherwise the 1.3 compatible behavior applies. *)
  107.  
  108.   ebSilentStart * = 6;
  109.  
  110. (* Magic kludge for CC0 use *)
  111.   ebStartCC0 * = 7;
  112.  
  113. (**-- Library Base variable --------------------------------------------*)
  114.  
  115. VAR
  116.  
  117.   base *  : ExpansionBasePtr;
  118.  
  119.  
  120. (**-- Library Functions ------------------------------------------------*)
  121.  
  122. (*
  123. **      $VER: expansion_protos.h 39.0 (31.10.91)
  124. *)
  125.  
  126. (* --- functions in V33 or higher (distributed as Release 1.2) ---*)
  127.  
  128. PROCEDURE AddConfigDev* [base,-30]
  129.   ( configDev [8] : c.ConfigDevPtr );
  130.  
  131. (* --- functions in V36 or higher (distributed as Release 2.0) ---*)
  132.  
  133. PROCEDURE AddBootNode* [base,-36]
  134.   ( bootPri    [0] : LONGINT;
  135.     flags      [1] : s.SET32;
  136.     deviceNode [8] : d.DeviceNodePtr;
  137.     configDev  [9] : c.ConfigDevPtr )
  138.   : BOOLEAN;
  139.  
  140. (* --- functions in V33 or higher (distributed as Release 1.2) ---*)
  141.  
  142. PROCEDURE AllocBoardMem* [base,-42]
  143.   ( slotSpec [0] : e.ULONG );
  144. PROCEDURE AllocConfigDev* [base,-48] ()
  145.   : c.ConfigDevPtr;
  146. PROCEDURE AllocExpansionMem* [base,-54]
  147.   ( numSlots  [0] : e.ULONG;
  148.     slotAlign [1] : e.ULONG )
  149.   : e.APTR;
  150. PROCEDURE ConfigBoard* [base,-60]
  151.   ( board     [8] : e.APTR;
  152.     configDev [9] : c.ConfigDevPtr );
  153. PROCEDURE ConfigChain* [base,-66]
  154.   ( baseAddr [8] : e.APTR );
  155. PROCEDURE FindConfigDev* [base,-72]
  156.   ( oldConfigDev [8] : c.ConfigDevPtr;
  157.     manufacturer [0] : LONGINT;
  158.     product      [1] : LONGINT )
  159.   : c.ConfigDevPtr;
  160. PROCEDURE FreeBoardMem* [base,-78]
  161.   ( startSlot [0] : e.ULONG;
  162.     slotSpec  [1] : e.ULONG );
  163. PROCEDURE FreeConfigDev* [base,-84]
  164.   ( configDev [8] : c.ConfigDevPtr );
  165. PROCEDURE FreeExpansionMem* [base,-90]
  166.   ( startSlot [0] : e.ULONG;
  167.     numSlots  [1] : e.ULONG );
  168. PROCEDURE ReadExpansionByte* [base,-96]
  169.   ( board  [8] : e.APTR;
  170.     offset [0] : e.ULONG )
  171.   : e.UBYTE;
  172. PROCEDURE ReadExpansionRom* [base,-102]
  173.   ( board     [8] : e.APTR;
  174.     configDev [9] : c.ConfigDevPtr );
  175. PROCEDURE RemConfigDev* [base,-108]
  176.   ( configDev [8] : c.ConfigDevPtr );
  177. PROCEDURE WriteExpansionByte* [base,-114]
  178.   ( board  [8] : e.APTR;
  179.     offset [0] : e.ULONG;
  180.     byte   [1] : e.UBYTE );
  181. PROCEDURE ObtainConfigBinding* [base,-120] ();
  182. PROCEDURE ReleaseConfigBinding* [base,-126] ();
  183. PROCEDURE SetCurrentBinding* [base,-132]
  184.   ( currentBinding [8] : c.CurrentBindingPtr;
  185.     bindingSize    [0] : e.UWORD );
  186. PROCEDURE GetCurrentBinding* [base,-138]
  187.   ( currentBinding [8] : c.CurrentBindingPtr;
  188.     bindingSize    [0] : e.UWORD )
  189.   : e.ULONG;
  190. PROCEDURE MakeDosNode* [base,-144]
  191.   ( parmPacket [8] : e.APTR )
  192.   : d.DeviceNodePtr;
  193. PROCEDURE AddDosNode* [base,-150]
  194.   ( bootPri    [0] : LONGINT;
  195.     flags      [1] : s.SET32;
  196.     deviceNode [8] : d.DeviceNodePtr )
  197.   : BOOLEAN;
  198.  
  199. (* --- functions in V36 or higher (distributed as Release 2.0) ---*)
  200.  
  201. (* --- REMEMBER: You are to check the version BEFORE you use this ! --- *)
  202. PROCEDURE ExpansionResrved26* [base,-156] ();
  203. PROCEDURE WriteExpansionWord* [base,-162]
  204.   ( board  [8] : e.APTR;
  205.     offset [0] : LONGINT;
  206.     word   [1] : INTEGER);
  207.  
  208.  
  209. (**-- Library Base variable --------------------------------------------*)
  210.  
  211. <*$LongVars-*>
  212.  
  213. (**-----------------------------------*)
  214. PROCEDURE* [0] CloseLib (VAR rc : LONGINT);
  215.  
  216. BEGIN (* CloseLib *)
  217.   IF base # NIL THEN e.CloseLibrary (base) END
  218. END CloseLib;
  219.  
  220. BEGIN
  221.   base := SYS.VAL ( ExpansionBasePtr,
  222.                     e.OpenLibrary (expansionName, e.libraryMinimum) );
  223.   IF base = NIL THEN HALT (100) END;
  224.   Kernel.SetCleanup (CloseLib)
  225. END Expansion.
  226.